package com.zhanglu.authentication.service;

import com.zhanglu.authentication.mapper.AuthRoleMapper;
import lombok.NonNull;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @description
 * @Auther zhanglu
 * @Date 2017/11/30 下午4:50
 */
@Service
@Slf4j
public class RoleService {
    @Autowired
    private AuthRoleMapper roleMapper;

    public List<String> selectRolesByUserId(@NonNull Long userId) {
        List<String> roles = roleMapper.getRoleNames(userId);
        log.info("selectRolesByUserId the user id is {}, and it's role are {}", userId, roles);
        return roles;
    }
}
